﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SwitchFileRead
	{
	class Program
		{
		static void Main(string[] args)
			{
				string oper = " ",loop = "Y";
				double n1 = 0, n2 = 0, answer = 0;
				while (loop.ToUpper() == "Y")
				{
					getNumbers(ref n1);
					getOperation(ref oper);
					getNumbers(ref n2);
					getAnswer(ref answer,n1,n2,oper);
					Console.WriteLine("{0}{1}{2} = {3}",n1,oper,n2,answer);
					Console.WriteLine("Type Y to enter another operation, or any other key to finish the program");
					loop = Console.ReadLine();
				}
			}

			static void getAnswer(ref double answer,double n1,double n2,string oper)
			{
			switch(oper)
				{
					case "+":
					answer = n1 + n2;
					break;
					case "-":
					answer = n1 - n2;
					break;
					case "*":
					answer = n1 * n2;
					break;
					case "/":
					answer = n1 / n2;
					break;
					default:
					Console.WriteLine("Invalid Operator Value");
					break;
				}
			}

			static void getOperation(ref string oper)
			{
			Console.WriteLine("Provide what type of operation will be done, ex: + , - , * , /");
			oper = Console.ReadLine();
			}

			static void getNumbers(ref double n1)
			{
			Console.WriteLine("Provide a number:");
			while(!double.TryParse(Console.ReadLine(), out n1))
				Console.WriteLine("Provide a valud number");
			}
		}
	}
